package org.jeecg.common.system.controller;

import javax.servlet.http.HttpServletRequest;

import org.jeecg.common.util.tencent.SignUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.PrintWriter;
import java.util.Enumeration;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("/api/v1")
public class AgentWeixinReplyController {




    @RequestMapping(value = "/wx/reply")
    public void get(HttpServletRequest request, HttpServletResponse response) throws Exception {

        System.out.println("========WechatController========= ");


        Enumeration pNames = request.getParameterNames();
        while (pNames.hasMoreElements()) {
            String name = (String) pNames.nextElement();
            String value = request.getParameter(name);
            // out.print(name + "=" + value);
            String log = "name =" + name + "     value =" + value;
        }
        System.out.println("========WechatControllertets========= ");
        String signature = request.getParameter("signature");/// 微信加密签名
        String timestamp = request.getParameter("timestamp");/// 时间戳
        String nonce = request.getParameter("nonce"); /// 随机数
        String echostr = request.getParameter("echostr"); // 随机字符串
        PrintWriter out = response.getWriter();

            System.out.println("校验成功！！！！！！！！！！！！！");
            out.print(echostr);


        out.close();
        out = null;

    }

}

